<template>
<body>
  <div class="container1">

      <label class="choose">&nbsp;&nbsp;你的得分为:{{resData.score}}</label>
        <div>
          <text>&nbsp;</text>
        </div>

    <div>
    <!--      <van-tag type="success">{{typeContent}}</van-tag>-->
          <div class="title">&nbsp;&nbsp;第{{current}}题:&nbsp;&nbsp;{{stemName[current-1]}}</div>

        </div>
        <div>
          <text>\n</text>
        </div>


        <div
          v-for="(option,index) in stemOptionList[current-1]"
          :key=option.id
          :data-name="option.content">
          <p class="p2">&nbsp;&nbsp;&nbsp;&nbsp;{{array[index]}}.&nbsp;&nbsp;{{option.content}}</p>
        </div>

              <div>
                <text>&nbsp;</text>
              </div>
              <p class="p2">&nbsp;&nbsp;你的选择：&nbsp;&nbsp;{{answer[current-1]}}</p>
              <div>
                <text>&nbsp;</text>
              </div>
              <p class="p2">&nbsp;&nbsp;解析：{{stemAnalysis[current-1]}}</p>
              <div>
                <text>&nbsp;</text>
              </div>
              <p class="p2">&nbsp;&nbsp;正确答案：&nbsp;&nbsp;{{resData.answers[current-1]}}</p>
        </div>

        </div>



  </div>
  <footer>
    <div class="weui-flex">
      <div class="weui-flex__item"><a href="javascript:" class="weui-btn weui-btn_primary" @click="last">
        上一题</a></div>
      <div class="weui-flex__item"><a href="javascript:" class="weui-btn weui-btn_primary" @click="next">
        下一题</a></div>
    </div>
  </footer>

  </body>
</template>

<script>

export default {

  data () {
    return {
      resData: [],
      answer: [],

      stemArray: [],//题干数组
      stemName:[],//题目名字
      stemOptionList:[],//题目选项
      stemAnswer:[],//题目正确答案
      stemAnalysis:[],//题目解析
      array:['A','B','C','D'],
      paperID: 0,

      current: 1,  //当前题目
      total: 10,    //总题数

      maxChoice: 1,  //判断单选或多选，单选为1，多选为4

    }
  },
  methods: {
    next() {
      //下一题
      if (this.current < this.total) {
        this.current = this.current+1
      }
    },

    last() {
      //上一题
      if (this.current > 1) {
        this.current = this.current-1
      }
    },
  },

  onLoad (option) {
      this.current=1
      this.answer = JSON.parse(decodeURIComponent(option.answer));
      this.resData = JSON.parse(decodeURIComponent(option.resData));
      console.log(this.resData.score)
      console.log(this.resData.answers)
      this.stemArray = JSON.parse(decodeURIComponent(option.resStem));

      for(var i=0;i<this.total;i++){
        this.stemName[i] = this.stemArray[i].name
        this.stemAnalysis[i] = this.stemArray[i].analysis
        this.stemOptionList[i]= this.stemArray[i].optionList
      }
  }
}



</script>

<style scoped>
  .container1{
    min-height: 90%;
    min-width: 100%;
  }
  .footer{
    height: 100px;
  }
  .btn_1{

  }

  .choose{
    font-size: 40rpx;
    margin-left:10rps;
  }

  .title{
    font-size: 40rpx;
  }
  .title1{
    font-size: 40rpx;
    text-align: center;
    font-weight: bold;
  }
  .p2{
    font-size: 36rpx;
  }
  .page1 {
    margin-left:400rpx;
    margin-top:5rpx;
    display: flex;
    flex-direction: row-reverse;
  }

  .page2 {
    margin-left:40rpx;
    margin-top:5rpx;
    display: flex;
    flex-direction: row-reverse;
  }
</style>
